package net.xxcxcxcx.xc_enhancedmob.skills.basics.individual.mystery;

import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.nbt.NbtCompound;
import net.xxcxcxcx.xc_enhancedmob.config.skill.SkillConfig;
import net.xxcxcxcx.xc_enhancedmob.mixin.DamageSourceMixin;
import net.xxcxcxcx.xc_enhancedmob.skills.BaseSkill;
import net.xxcxcxcx.xc_enhancedmob.skills.Ref;
import net.xxcxcxcx.xc_enhancedmob.skills.SkillRarity;

public class PunctureSkill extends BaseSkill {

    public PunctureSkill(int level) {
        super(level);
    }

    public PunctureSkill(NbtCompound nbtCompound) {
        super(nbtCompound);
    }

    public PunctureSkill() {
    }

    @Override
    public SkillConfig getDefaultConfig() {
        SkillConfig skillConfig = super.getDefaultConfig();
        skillConfig.setMessage(getConfigMessage(skillConfig));
        return skillConfig;
    }

    @Override
    public String getConfigMessage(SkillConfig skillConfig) {
        if (skillConfig == null) return super.getConfigMessage(null);
        return "穿刺技能，无视目标保护等级。";
    }

    @Override
    public SkillRarity getSkillRarity() {
        return SkillRarity.Mystery;
    }

    @Override
    public boolean onAttack(MobEntity attacker, LivingEntity target, DamageSource source, Ref<Float> amount, boolean ismob, boolean remote) {
        try {
            ((DamageSourceMixin) (source)).setUnblockableSkill();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return true;
    }
}
